<?php
/**
 * @description:
 * @author     : Geomen
 * @time       : 2018/4/16 16:48
 */


namespace App\Http\Controllers;


use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;

class AccountController extends Controller
{
    public function login(Request $request)
    {
        $name = e($request->input('name'));
        $password = e($request->input('password'));
        $remember = $request->input('remember');
        if (Auth::attempt(compact('name','password'),$remember)){
            return response()->json(['r' => 1000,'i' => '登录成功','data' => Auth::user()]);
        }else{
            return response()->json(['r' => 2000,'i' => '用户名或密码错误']);
        }
    }
}